<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>银行流水导入系统API文档</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1, h2, h3 {
            color: #333;
        }
        h1 {
            text-align: center;
            border-bottom: 2px solid #007bff;
            padding-bottom: 10px;
        }
        h2 {
            border-left: 4px solid #007bff;
            padding-left: 10px;
            margin-top: 30px;
        }
        h3 {
            margin-top: 20px;
            color: #007bff;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 15px 0;
        }
        table, th, td {
            border: 1px solid #ddd;
        }
        th, td {
            padding: 12px;
            text-align: left;
        }
        th {
            background-color: #f8f9fa;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background-color: #f8f9fa;
        }
        tr:hover {
            background-color: #e9ecef;
        }
        .endpoint {
            background-color: #f8f9fa;
            padding: 15px;
            border-radius: 4px;
            margin: 15px 0;
            border-left: 4px solid #007bff;
        }
        .method {
            display: inline-block;
            padding: 3px 8px;
            border-radius: 3px;
            color: white;
            font-weight: bold;
            margin-right: 10px;
        }
        .get {
            background-color: #28a745;
        }
        .post {
            background-color: #007bff;
        }
        .put {
            background-color: #ffc107;
            color: #212529;
        }
        .delete {
            background-color: #dc3545;
        }
        pre {
            background-color: #f8f9fa;
            padding: 15px;
            border-radius: 4px;
            overflow-x: auto;
        }
        code {
            font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>银行流水导入系统API文档</h1>
        
        <h2>概述</h2>
        <p>银行流水导入系统支持自定义字段映射功能，允许用户根据不同的银行流水格式配置字段映射关系，实现灵活的银行流水导入。系统特别支持处理不同银行的复杂流水格式。</p>
        
        <h2>基础配置管理API</h2>
        
        <div class="endpoint">
            <span class="method post">POST</span>
            <strong>/bankFlowImportConfig/save</strong>
            <p>保存银行流水导入配置</p>
        </div>
        <h3>请求参数</h3>
        <table>
            <thead>
                <tr>
                    <th>参数名</th>
                    <th>类型</th>
                    <th>必填</th>
                    <th>说明</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>configName</td>
                    <td>string</td>
                    <td>是</td>
                    <td>配置名称</td>
                </tr>
                <tr>
                    <td>bankType</td>
                    <td>string</td>
                    <td>是</td>
                    <td>银行类型</td>
                </tr>
                <tr>
                    <td>fileType</td>
                    <td>string</td>
                    <td>是</td>
                    <td>文件类型 (Excel/CSV)</td>
                </tr>
                <tr>
                    <td>remark</td>
                    <td>string</td>
                    <td>否</td>
                    <td>备注</td>
                </tr>
            </tbody>
        </table>
        
        <div class="endpoint">
            <span class="method post">POST</span>
            <strong>/bankFlowImportConfig/update</strong>
            <p>更新银行流水导入配置</p>
        </div>
        <h3>请求参数</h3>
        <table>
            <thead>
                <tr>
                    <th>参数名</th>
                    <th>类型</th>
                    <th>必填</th>
                    <th>说明</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>id</td>
                    <td>long</td>
                    <td>是</td>
                    <td>配置ID</td>
                </tr>
                <tr>
                    <td>configName</td>
                    <td>string</td>
                    <td>是</td>
                    <td>配置名称</td>
                </tr>
                <tr>
                    <td>bankType</td>
                    <td>string</td>
                    <td>是</td>
                    <td>银行类型</td>
                </tr>
                <tr>
                    <td>fileType</td>
                    <td>string</td>
                    <td>是</td>
                    <td>文件类型 (Excel/CSV)</td>
                </tr>
                <tr>
                    <td>remark</td>
                    <td>string</td>
                    <td>否</td>
                    <td>备注</td>
                </tr>
            </tbody>
        </table>
        
        <div class="endpoint">
            <span class="method post">POST</span>
            <strong>/bankFlowImportConfig/list</strong>
            <p>查询银行流水导入配置列表</p>
        </div>
        <h3>请求参数</h3>
        <table>
            <thead>
                <tr>
                    <th>参数名</th>
                    <th>类型</th>
                    <th>必填</th>
                    <th>说明</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>configName</td>
                    <td>string</td>
                    <td>否</td>
                    <td>配置名称（模糊查询）</td>
                </tr>
                <tr>
                    <td>bankType</td>
                    <td>string</td>
                    <td>否</td>
                    <td>银行类型</td>
                </tr>
                <tr>
                    <td>status</td>
                    <td>int</td>
                    <td>否</td>
                    <td>状态（0:启用 1:禁用）</td>
                </tr>
                <tr>
                    <td>page</td>
                    <td>int</td>
                    <td>是</td>
                    <td>页码</td>
                </tr>
                <tr>
                    <td>limit</td>
                    <td>int</td>
                    <td>是</td>
                    <td>每页条数</td>
                </tr>
            </tbody>
        </table>
        
        <div class="endpoint">
            <span class="method get">GET</span>
            <strong>/bankFlowImportConfig/allEnabled</strong>
            <p>查询所有启用的银行流水导入配置</p>
        </div>
        
        <div class="endpoint">
            <span class="method get">GET</span>
            <strong>/bankFlowImportConfig/info/{id}</strong>
            <p>根据ID获取银行流水导入配置</p>
        </div>
        
        <div class="endpoint">
            <span class="method get">GET</span>
            <strong>/bankFlowImportConfig/getByBankType</strong>
            <p>根据银行类型获取银行流水导入配置</p>
        </div>
        <h3>请求参数</h3>
        <table>
            <thead>
                <tr>
                    <th>参数名</th>
                    <th>类型</th>
                    <th>必填</th>
                    <th>说明</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>bankType</td>
                    <td>string</td>
                    <td>是</td>
                    <td>银行类型</td>
                </tr>
            </tbody>
        </table>
        
        <div class="endpoint">
            <span class="method post">POST</span>
            <strong>/bankFlowImportConfig/delete/{id}</strong>
            <p>删除银行流水导入配置</p>
        </div>
        
        <h2>字段映射配置</h2>
        <p>字段映射配置以JSON格式存储在bank_flow_import_config表的field_mapping字段中，格式如下：</p>
        <pre><code>[
    {
        "columnIndex": 0,
        "columnName": "交易日期",
        "systemFieldName": "tradingTime",
        "systemFieldDisplayName": "交易时间",
        "fieldType": "normal"
    },
    {
        "columnIndex": 1,
        "columnName": "收入金额",
        "systemFieldName": "incomeAmount",
        "systemFieldDisplayName": "收入金额(情况一)",
        "fieldType": "incomeAmount"
    },
    {
        "columnIndex": 2,
        "columnName": "支出金额",
        "systemFieldName": "expenseAmount",
        "systemFieldDisplayName": "支出金额(情况一)",
        "fieldType": "expenseAmount"
    },
    {
        "columnIndex": 4,
        "columnName": "交易类型",
        "systemFieldName": "typeIdentifier",
        "systemFieldDisplayName": "类型标识(情况二/三)",
        "fieldType": "typeIdentifier"
    }
]</code></pre>
        
        <h3>字段类型说明</h3>
        <table>
            <thead>
                <tr>
                    <th>字段类型</th>
                    <th>说明</th>
                    <th>适用场景</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>normal</td>
                    <td>普通字段</td>
                    <td>常规字段映射</td>
                </tr>
                <tr>
                    <td>incomeAmount</td>
                    <td>收入金额字段</td>
                    <td>情况一：收入/支出金额分离格式</td>
                </tr>
                <tr>
                    <td>expenseAmount</td>
                    <td>支出金额字段</td>
                    <td>情况一：收入/支出金额分离格式</td>
                </tr>
                <tr>
                    <td>typeIdentifier</td>
                    <td>类型标识字段</td>
                    <td>情况二/三：借/贷标识或来账/往账标识</td>
                </tr>
            </tbody>
        </table>
        
        <h2>银行流水导入API</h2>
        
        <div class="endpoint">
            <span class="method post">POST</span>
            <strong>/tradingFlow/upload</strong>
            <p>上传并导入银行流水</p>
        </div>
        <h3>请求参数</h3>
        <table>
            <thead>
                <tr>
                    <th>参数名</th>
                    <th>类型</th>
                    <th>必填</th>
                    <th>说明</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>file</td>
                    <td>file</td>
                    <td>是</td>
                    <td>银行流水文件（Excel/CSV）</td>
                </tr>
                <tr>
                    <td>accountId</td>
                    <td>long</td>
                    <td>是</td>
                    <td>资金账户ID</td>
                </tr>
            </tbody>
        </table>
        
        <h2>系统支持的字段</h2>
        <table>
            <thead>
                <tr>
                    <th>字段名</th>
                    <th>显示名称</th>
                    <th>说明</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>tradingTime</td>
                    <td>交易时间</td>
                    <td>交易发生的时间</td>
                </tr>
                <tr>
                    <td>tradingAmount</td>
                    <td>交易金额</td>
                    <td>本次交易的金额</td>
                </tr>
                <tr>
                    <td>incomeAmount</td>
                    <td>收入金额(情况一)</td>
                    <td>收入金额字段（情况一）</td>
                </tr>
                <tr>
                    <td>expenseAmount</td>
                    <td>支出金额(情况一)</td>
                    <td>支出金额字段（情况一）</td>
                </tr>
                <tr>
                    <td>typeIdentifier</td>
                    <td>类型标识(情况二/三)</td>
                    <td>类型标识字段（情况二/三）</td>
                </tr>
                <tr>
                    <td>balanceAmount</td>
                    <td>账户余额</td>
                    <td>交易后的账户余额</td>
                </tr>
                <tr>
                    <td>tradingType</td>
                    <td>交易类型</td>
                    <td>交易类型：INCOME(收入)、EXPENSE(支出)、REFUND(退款)</td>
                </tr>
                <tr>
                    <td>status</td>
                    <td>交易状态</td>
                    <td>交易状态：SUCCESS(成功)、FAILED(失败)、PROCESSING(处理中)</td>
                </tr>
                <tr>
                    <td>channel</td>
                    <td>支付渠道</td>
                    <td>支付渠道：WECHAT(微信)、ALIPAY(支付宝)、BANK(银行)</td>
                </tr>
                <tr>
                    <td>bankName</td>
                    <td>对方银行名称</td>
                    <td>交易对手方的银行名称</td>
                </tr>
                <tr>
                    <td>bankNo</td>
                    <td>对方银行卡号</td>
                    <td>交易对手方的银行卡号</td>
                </tr>
                <tr>
                    <td>counterparty</td>
                    <td>交易对手方</td>
                    <td>交易的对方名称</td>
                </tr>
                <tr>
                    <td>tradingDescription</td>
                    <td>交易描述</td>
                    <td>对本次交易的描述</td>
                </tr>
                <tr>
                    <td>remark</td>
                    <td>备注</td>
                    <td>交易备注信息</td>
                </tr>
            </tbody>
        </table>
        
        <h2>使用示例</h2>
        <h3>1. 保存银行流水导入配置</h3>
        <pre><code>POST /bankFlowImportConfig/save
Content-Type: application/json

{
    "configName": "中国银行流水导入配置",
    "bankType": "BOC",
    "fileType": "Excel",
    "remark": "中国银行标准流水格式"
}</code></pre>
        
        <h3>2. 配置字段映射</h3>
        <p>更新配置时，在fieldMapping字段中设置JSON格式的字段映射关系：</p>
        <pre><code>PUT /bankFlowImportConfig/update
Content-Type: application/json

{
    "id": 1,
    "configName": "中国银行流水导入配置",
    "bankType": "BOC",
    "fileType": "Excel",
    "fieldMapping": "[{\"columnIndex\":0,\"columnName\":\"交易日期\",\"systemFieldName\":\"tradingTime\",\"systemFieldDisplayName\":\"交易时间\",\"fieldType\":\"normal\"},{\"columnIndex\":1,\"columnName\":\"收入金额\",\"systemFieldName\":\"incomeAmount\",\"systemFieldDisplayName\":\"收入金额(情况一)\",\"fieldType\":\"incomeAmount\"}]",
    "remark": "中国银行标准流水格式"
}</code></pre>
        
        <h3>3. 导入银行流水</h3>
        <pre><code>POST /tradingFlow/upload
Content-Type: multipart/form-data

file: boc_flow.xlsx
accountId: 1001</code></pre>
    </div>
</body>
</html>